package com.example.eureka_client.controller;


import com.example.eureka_client.entity.UacRole;
import com.example.eureka_client.httpResult.Result;
import com.example.eureka_client.httpResult.ResultGenerator;
import com.example.eureka_client.service.IUacRoleService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.UUID;

/**
 * <p>
 * 角色表 前端控制器
 * </p>
 *
 * @author plj
 * @since 2022-03-24
 */
@RestController
@RequestMapping("/uac-role")
public class UacRoleController {
    private static final java.util.UUID UUID = java.util.UUID.randomUUID();
    @Resource
    IUacRoleService iUacRoleService;



    @PostMapping("insert")
    public Result insert(@RequestBody UacRole uacRole){
        uacRole.setId(UUID.randomUUID().toString());
        boolean flag = iUacRoleService.save(uacRole);
        if(flag){
            return ResultGenerator.genSuccessResult();
        }else {
            return ResultGenerator.genFailResult("角色生成失败");
        }
    }
}
